<template>
    <div class="bg">
      <div class="login-tit">智慧停车后台管理系统</div>
      <div class="login-wrap">
        <el-input
          placeholder="请输入用户名"
          v-model="username">
          <img src="../../assets/images/account.png" slot="prefix" width="19" height="21" class="login-img">
        </el-input>
        <el-input
          class="pass-box"
          placeholder="请输入密码"
          v-model="password"
          type="password">
          <img src="../../assets/images/pass.png" slot="prefix" width="19" height="21" class="login-img">
        </el-input>
        <el-button class="login-btn" @click="loginClick">登录</el-button>
      </div>
    </div>
</template>

<script>
export default {
  name: 'index',
  data () {
    return {
      username: '',
      password: ''
    }
  },
  methods: {
    loginClick () {
      if (!this.username) {
        this.$message.error('请输入用户名')
        return
      }
      if (!this.password) {
        this.$message.error('请输入密码')
        return
      }
      this.$store.dispatch('login', {
        // username: 'admin_area',
        // username: 'admin_community',
        // password: '123456'
        username: this.username,
        password: this.password
      }).then(res => {
        this.$message({
          message: '登录成功',
          type: 'success',
          duration: 1500,
          onClose: () => {
            this.$router.push('/')
          }
        })
      })
    }
  }
}
</script>

<style scoped>
.bg {
  width: 100%;
  height: 100vh;
  background: url("../../assets/images/login_bg.png") no-repeat;
  background-size: 100% 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
  .login-tit{
    font-size: 48px;
    color: #ffffff;
    margin-bottom: 90px;
  }
  .login-wrap{
    width: 558px;
    height: 428px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 86px 96px;
    box-sizing: border-box;
    border-radius: 30px;
  }
  .login-img{
    margin-top: 10px;
    padding: 0 5px;
    margin-right: 5px;
  }
 >>>.el-input__inner{
  padding-left: 40px!important;
}
  .pass-box{
    margin: 35px 0;
  }
  .login-btn {
    width:366px;
    height:56px;
    background:linear-gradient(0deg,rgba(151,171,185,1),rgba(239,248,249,1));
    border-radius:4px;
    margin-top: 40px;
    font-size: 20px;
    color: #39546A;
  }
</style>
